// Copyright 2011 Valentin Kasas.
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/*
Package gorila/mime provides a convenience http.Handler wraper that filters incoming
requests according to a registered list of supported MIME types.

The requested MIME type resolution follows the two steps below : 
    1. the request's URL is scanned for an extension which is in turn analysed to deduce a MIME type (using the standard mime package)
    2. if no MIME type was found during step 1, the requests headers are scanned for a Content-Type header 

Once the requested MIME type is resolved, it is matched against the MIME types attached to the Handler, 
if a match is found, the Handler process the request normally. Otherwise an empty response with a 404 
status code is sent back to the client.

Example :
    func init(){
        http.Handle("/", &mime.MimeAwareHandler{
            handler : http.HandlerFunc( func (w http.ResponseWriter, r *http.Request) {
                // request processing
            }),
            mimeTypes : []string { "application/xml", "application/json" }  // attach two MIME types to the above handler
        })
        http.ListenAndServe(":8080", nil)
    }

This example server will only respond to requests with URL like :
    http://hostname:8080/foo.xml
    http://hostname:8080/bar/baz.json?param=value
or requests having one of the following header:
    Content-Type : application/xml
    Content-Type : application/json
*/
package mime
